package ru.pb.game.objects.model.clan;

import ru.pb.game.objects.storage.IStoreableObject;
import ru.pb.game.objects.storage.ObjectsStorage;
import ru.pb.global.data.model.ClanInfo;

public class Clan implements IStoreableObject
{
	public static final int NET_CLAN_NAME_SIZE = 17;
	public static final int NET_CLAN_NOTICE_SIZE = 255;
	public static final int NET_CLAN_INTRO_SIZE = 255;
	public static final int NET_CLAN_REQUEST_SIZE = 255;
	public static final int NET_CLAN_AZIT_URL_SIZE = 21;

	private int _objectId;
	private long _storedId;

	private ClanInfo _clanInfo;

	public Clan(ClanInfo info)
	{
		this(info.getClanId(), info.getClanName());
	}

	private Clan(final int objectId, String name)
	{
		_objectId = objectId;
		_storedId = ObjectsStorage.getInstance().put(this);
	}

	@Override
	public int getObjectId()
	{
		return _objectId;
	}

	@Override
	public long getStoredId()
	{
		return _storedId;
	}

	@Override
	public String getName()
	{
		return getClanInfo().getClanName();
	}

	public ClanInfo getClanInfo()
	{
		return _clanInfo != null ? _clanInfo : new ClanInfo();
	}
}